<template>
  <c-select
    v-bind="$attrs"
    filterable
    :value="value"
    :options="options"
    :props="props"
    @change="hangleChange"
  ></c-select>
</template>

<script>
export default {
  components: {},
  props: {
    value: {
      type: String,
      default: '',
    },
  },
  model: {
    prop: 'value',
    event: 'change',
  },
  data() {
    return {
      loading: false,
      options: [],
      props: {
        label: 'enum_value',
        value: 'enum_key',
      },
    }
  },
  computed: {},
  watch: {},
  created() {
    this.getData()
  },
  mounted() {},
  methods: {
    getData() {
      this.loading = true
      this.$api
        .getData({
          table: 'system_enum',
          params: {
            'enum_field.eq': 'datum_one_county_industry.main_business',
          },
        })
        .then(res => {
          this.options = res.data
        })
        .finally(() => {
          this.loading = false
        })
    },
    hangleChange(val) {
      this.$emit('change', val)
    },
  },
}
</script>

<style lang="scss" scoped></style>
